<?php
/**
 * Created by PhpStorm.
 * User: sunshine
 * Date: 2016/8/31
 * Time: 8:47
 */
require 'Admin/Model/Model.php';
class PainfoModel extends Model{
    function __Construct(){
        parent::__Construct();
    }
    function getPainfoList(){
        $sql = "select * from painfo";
        $data = $this->conn->query($sql);
        return $data;
    }
    function addPainfo($data){

        $painfo = array(
            'pname' => trim($data['pname']),
            'createtime'=>date("YmdHis"),
            'totaltime'=>$data['totaltime'],
            'code'=>$data['code']
        );
        $keys = implode(',',array_keys($painfo));
        $values = implode("','", array_values($painfo));
        $sql="insert into painfo ({$keys}) VALUES ('{$values}')";
        //执行SQL语句
        $d = $this->conn->query($sql);
        return $d;
    }

}
?>